import * as poker from "./poker.ts";
import { test, assertEquals } from "../test_deps.ts";

test("Create a new pocker", () => {
  const pokers = poker.create();
  console.log(pokers);
  console.log(poker.parse(412));
});

test("sort pocker", () => {
  // prettier-ignore
  const sorted = [
    521, 520, 412, 312, 212, 112, 411, 311,
    211, 111, 410, 310, 210, 110, 409, 309,
    209, 109, 408, 308, 208, 108, 407, 307,
    207, 107, 406, 306, 206, 106, 405, 305,
    205, 105, 404, 304, 204, 104, 403, 303,
    203, 103, 402, 302, 202, 102, 401, 301,
    201, 101, 400, 300, 200, 100
  ];

  const pokers = poker.create();

  console.log(pokers);

  console.log(poker.sort(pokers));

  assertEquals(sorted, poker.sort(pokers));
});

test("poker.isSingle", () => {
  assertEquals(false, poker.isSingle([101, 102]));
  assertEquals(true, poker.isSingle([101]));
  assertEquals(true, poker.isPair([101, 201]));
  assertEquals(false, poker.isPair([102, 201]));
});

test("poker.isPair", () => {
  assertEquals(true, poker.isPair([101, 201]));
  assertEquals(false, poker.isPair([102, 201]));
  assertEquals(false, poker.isPair([101, 201, 301]));
});
